package com.lin.project.cloudnative.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: MyBatis Plus 配置
 * @author: linhuaixu
 * @time: 2023/5/15 20:25
 */
@Configuration
@MapperScan("com.lin.project.cloudnative.mapper")
public class MyBatisPlusConfig {

    /**
     *
     *
     * @description: 分页拦截器配置
     * @return:
     * @author: linhuaixu
     * @time: 2023/5/15 20:28
     */

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor=new MybatisPlusInterceptor();
        //分页插件
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return mybatisPlusInterceptor;
    }
}
